package com.sugon.modules.device.model.dto;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 设备维护工单执行状况产线统计DTO
 *
 * @Author YuXD
 * @Version 1.0
 * @since 2023/2/13
 */
@NoArgsConstructor
@Data
public class DevAmTicketLineStatDTO implements Serializable {

    /**
     * 生产线
     */
    private String lineName;

    /**
     * 工单数
     */
    private Integer ticketNum;

    /**
     * 超期工单数
     */
    private Long overtimeNum;

    /**
     * 维护项数
     */
    private Integer amItemNum;

    /**
     * 维护项-已完成数
     */
    private Long amItemEdNum;

    /**
     * 维护项-未执行数
     */
    private Long amItemUnNum;

    /**
     * 维护项延期完成数
     */
    private Long amItemOvertimeNum;

    /**
     * 延期完成项目超期时长（最小值）分钟
     */
    private String minAmItemOvertimeNum;

    /**
     * 延期完成项目超期时长（最大值）分钟
     */
    private String maxAmItemOvertimeNum;

    /**
     * 延期完成项目超期时长（平均值）分钟
     */
    private String avgAmItemOvertimeNum;

    /**
     * 延期完成工单号（最长超期）
     */
    private String maxOvertimeAmTicketCode;


    public DevAmTicketLineStatDTO(String lineName, Integer ticketNum) {
        this.lineName = lineName;
        this.ticketNum = ticketNum;
        this.maxOvertimeAmTicketCode = "";
        this.minAmItemOvertimeNum = "";
        this.maxAmItemOvertimeNum = "";
        this.avgAmItemOvertimeNum = "";
    }

    public void setMinAmItemOvertimeNum(Long minAmItemOvertimeNum) {
        if (minAmItemOvertimeNum != null && minAmItemOvertimeNum < 10080) {
            this.minAmItemOvertimeNum = minAmItemOvertimeNum + "";
        }
    }

    public void setMaxAmItemOvertimeNum(Long maxAmItemOvertimeNum) {
        if (maxAmItemOvertimeNum != null && maxAmItemOvertimeNum > 0) {
            this.maxAmItemOvertimeNum = maxAmItemOvertimeNum + "";
        }
    }

    public void setAvgAmItemOvertimeNum(Long avgAmItemOvertimeNum) {
        if (avgAmItemOvertimeNum != null && avgAmItemOvertimeNum > 0) {
            this.avgAmItemOvertimeNum = avgAmItemOvertimeNum + "";
        }
    }
}
